package com.jiuyou.storeController.opinion;

import com.jiuyou.storeController.common.StoreBaseController;
import com.ruoyi.common.constant.DicConstants;
import com.ruoyi.framework.web.service.MemberTokenService;
import com.ruoyi.opinion.domain.Opinion;
import com.ruoyi.opinion.service.IOpinionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * B端商家反馈
 * @author chengliang
 * @date 2021/11/15
 **/
@RestController
@RequestMapping("/store/opinion")
public class OpinionStoreController extends StoreBaseController {

    @Autowired
    private IOpinionService opinionService;

    @PutMapping
    public boolean create(@RequestBody Opinion opinion){
        try{
            Long loginStoreUserId = getLoginStoreUserId();
            opinion.setSubUserId(loginStoreUserId);
            opinion.setOpinionType(DicConstants.BUSINESS_Business.getCode());
            opinionService.insertOpinion(opinion);
            return true;
        }catch (Exception e){
            return false;
        }
    }
}
